package agents

import (
	"k8sops/pkg/services"
	"log"
)

func NamespaceResources(namespace string) (resource map[string]int64, err error) {
	pods, err := services.GetPods(namespace)
	if err != nil {
		log.Fatal(err)
		return
	}

	resource = make(map[string]int64)

	for _, pod := range pods.Items {
		cpu, memory := GetPodResource(pod, namespace)
		resource["cpu"] += cpu
		resource["memory"] += memory
	}
	return
}
